package com.employee.controller;

import com.employee.pojo.dto.UpdateShenPiRenDTO;
import com.employee.pojo.result.Result;
import com.employee.pojo.vo.KaoQinRenVO;
import com.employee.pojo.vo.ShenPiRenVO;
import com.employee.service.ShenpiRenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ShenPiRenController {
    @Autowired
    ShenpiRenService shenpiRenService;
    @GetMapping("getShenPiRenList")
    public Result<List<ShenPiRenVO>> getShenPiRenList(){
        return Result.success(shenpiRenService.getShenPiRenList());
    }

    //搜索
    @GetMapping("/selectByName/{name}")
    public Result<List<ShenPiRenVO>> selectByName(@PathVariable String name){
        return Result.success(shenpiRenService.selectByName(name));
    }
    //显示拥有考勤审批权限人列表
    @GetMapping("getKaoQinRenList")
    public Result<List<KaoQinRenVO>>  getKaoQinRenList(){
        return Result.success(shenpiRenService.getKaoQinRenList());
    }
    //显示拥有请假审批权限人列表
    @GetMapping("getQingJiaRenList")
    public Result<List<KaoQinRenVO>>  getQingJiaRenList(){
        return Result.success(shenpiRenService.getQingJiaRenList());
    }
    //更新dept表中的审批人
    @PostMapping("/updateShenPiRen")
    public Result updateShenPiRen(@RequestBody UpdateShenPiRenDTO updateShenPiRenDTO){
        System.out.println("----------------"+updateShenPiRenDTO);
        shenpiRenService.updateShenPiRen(updateShenPiRenDTO);
        return Result.success();
    }
}

